Git Kata 5: Run a Git Server
Learn about Gogs and running a Git server.
So far, we’ve been working with a local repository. Local repositories are used by an individual developer to work with a local copy of a codebase. The previous katas have demonstrated how to commit changes to a local repository.
This kata will start work with a remote repository. The first step is to set up a local Git server. We’ll be using Gogs, an open-source, lightweight Git server.
Step 1: Create an admin account of Gogs#
To create a new account:
- Click the “Need an account?” link and create an account with the following details:
- Username: “devops”
- Email: “devops@devopskatas.com”
- Password: “katas”
Gogs starts for the first time after setup with no accounts. The first account that’s set up in Gogs will automatically be made an administrator. This step registers a new user with Gogs. We can use the same username/password combination as the LVM account or choose another. This account is created in Gogs and is different from the account used to log in to the LVM.
Then, we log in to Gogs with the account credentials we just created.
Step 2: Create a repository#
Select “New Repository” from the plus (+) drop-down.
Enter “web-storelist” in the “Repository Name” section and then click the “Create Repository” button.
This step creates a new repository called “web-storelist.” We’ll use this repository in the next kata to learn about how multiple developers collaborate by contributing to the remote repository.
Step 3: Add users#
The following is the sequence of steps to add users:
- Open the “Admin Panel.”
- Select “Users.”
- Click “Create New Account.”
- Keep the following:
- Username: “ken.coder”
- Email: “ken@thecoders.com”
- Password: “katas”
- Select “Users” from the left navigation and create a second account.
- Keep the following:
- Username: “carrie.coder”
- Email: “carrie@thecoders.com”
- Password: “katas”
- Click “Create New Account.”
Step 4: Set the repository permissions#
The following is the sequence of steps to set repository permissions:
- Click “Dashboard” in the top navigation bar.
- Select “web-storelist” under “My Repositories.”
- Click “Settings” on the right.
- Click “Collaboration” on the left.
- Enter “ken” in the field; select the “ken.coder” account.
- Click “Add New Collaborator.”
Repeat the previous steps for the “carrie.coder” account.
This step creates two new users, Ken and Carrie Coder. Ken and Carrie are granted write access by default. This will allow them to contribute to this repository.
Ken and Carrie will be formally introduced Git Kata 7.
Git Kata 4: Merge Conflicts
Git Kata 6: Remote Repositories